<?php

/**
 * Aurorum - Open source digital signage
 *
 * @link http://digitalsignage.tk
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 *
 * @category Aurorum
 * @package Aurorum
 */

/**
 * This class stores changes that appears in application.
 *
 * @package Aurorum
 * @subpackage Core
 */

class ADS_Logger{
    
    public static function logChange($msg){
        if(!is_string($msg)){
            throw new InvalidArgumentException(sprintf('Wrong parameters for method %.',__METHOD__));
        }
        //prepare message to log
        $args = func_get_args();unset($args[0]);
        if(!empty($args))
            $msg = vsprintf($msg,$args);
        //log change
        $chModel = new ADS_ChangelogModel();
        $chModel->addChange(array(
            'message' => $msg
        ));
    }
    
    public static function commitChanges($deploymentId){
        if(!is_int($deploymentId)){
            throw new InvalidArgumentException(sprintf('Wrong parameters for method %.',__METHOD__));
        }
        //commit changes
        $chModel = new ADS_ChangelogModel();
        $chModel->commitChanges($deploymentId);
    }
    
}
